{include file="public/header"/}
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcfcms.css?v={$version}"/>
<script src="{__PUBLIC_PATH}/common/js/jquery.js?v={$version}"></script>
<script src="{__PUBLIC_PATH}/admin/pcf/global.js?v={$version}"></script>
</head>
<body>
<div class="layui-form">
<div class="layui-fluid" style="padding-bottom:83px;border:0;">
<div class="layui-col-sm12">
<div class="layui-card" style="box-shadow:0 0 0 0;">
  <div class="layui-tab layui-tab-brief" id="pcfsystem">
    <ul class="layui-tab-title" style="background-color:#f2f2f2;">
        <a href="{:url('/system.web/index')}"><li>网站设置</li></a>
        <a href="{:url('/system.web/web2')}"><li>核心设置</li></a>
        <a href="{:url('/system.web/basic')}"><li class="layui-this">附件设置</li></a>
        <a href="{:url('/system.web/weapp_email')}"><li>邮箱配置</li></a>
        <a href="{:url('/system.web/weapp_sms')}"><li>短信配置</li></a>
        <a href="{:url('/system.web/weapp_pay')}" style="display:none;"><li>支付配置</li></a>
        <a href="{:url('/system.web/weapp_social')}" style="display:none;"><li>第三方登录配置</li></a>
    </ul>
    <div class="layui-tab-content">
      <div class="layui-form-item">
        <label class="layui-form-label">主页链接名</label>
        <div class="layui-input-inline">
          <input type="text" name="basic_indexname" value="{$config.basic_indexname|default='首页'}" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">栏目位置间隔符</label>
        <div class="layui-input-inline">
          <input type="text" name="list_symbol" value="{$config.list_symbol|default=' > '}" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item" style="margin-bottom:5px;">
        <label class="layui-form-label">上传图片类型</label>
        <div class="layui-input-inline">
            <textarea name="image_type" class="layui-textarea">{empty name='config.image_type'}jpg|gif|png|bmp|jpeg|ico{else /}{$config.image_type}{/empty}</textarea>
        </div>
      </div>
	  <div class="layui-form-item">
	   <label class="layui-form-label"></label>
	   <div class="layui-input-inline auto gray" style="color:#009688;">禁止非图片的扩展名，比如：php</div>
	  </div>
	  
      <div class="layui-form-item" style="margin-bottom:5px;">
        <label class="layui-form-label">上传软件类型</label>
        <div class="layui-input-inline">
            <textarea name="file_type" class="layui-textarea">{empty name='config.file_type'}zip|gz|rar|iso|doc|xsl|ppt|wps{else /}{$config.file_type}{/empty}</textarea>
        </div>
      </div>
	  <div class="layui-form-item">
	   <label class="layui-form-label"></label>
	   <div class="layui-input-inline auto gray" style="color:#009688;">禁止非图片的扩展名，比如：php</div>
	  </div>
	  
      <div class="layui-form-item" style="margin-bottom:5px;">
        <label class="layui-form-label">多媒体文件类型</label>
        <div class="layui-input-inline">
              <textarea name="media_type" class="layui-textarea">{empty name='config.media_type'}swf|mpg|mp3|rm|rmvb|wmv|wma|wav|mid|mov|mp4{else /}{$config.media_type}{/empty}</textarea>
        </div>
      </div>
	  <div class="layui-form-item">
	   <label class="layui-form-label"></label>
	   <div class="layui-input-inline auto gray" style="color:#009688;">禁止非图片的扩展名，比如：php</div>
	  </div>
	  
      <div class="layui-form-item" style="margin-bottom:5px;">
        <label class="layui-form-label">附件上传大小</label>
        <div class="layui-input-inline default-auto">
            <input style="width:100px;float:left" type="text" name="file_size" lay-verify="number|check_filesize" value="{$config.file_size|default=$max_filesize}" class="layui-input"> 
            <span style="float:left;line-height:38px;margin-left:4px;"> {$max_sizeunit}</span>
        </div>
      </div>
	  <div class="layui-form-item">
	   <label class="layui-form-label"></label>
	   <div class="layui-input-inline auto gray" style="color:#009688;">附件上传大小限制，如果空间不支持，请与空间商联系修改php.ini部分参数</div>
	  </div>
    </div>
  </div>
</div>
</div>
<div class="submit-info text-center">
    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
</div>
<div class="pcfclear"></div>
</div>
</div>
{include file="public/footer"/}
<script type="text/javascript">
    layui.use(['layer', 'form', 'element', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var element = layui.element;
        var admin = layui.admin;
        form.verify({
          check_filesize: function(value, item){
            var file_size = value;
            var max_filesize = parseInt($('#max_filesize').val());
            var max_sizeunit = $('#max_sizeunit').val();
            if (0 < max_filesize && max_filesize < file_size) {
                return '附件上传大小超过空间的最大限制'+max_filesize+max_sizeunit;
            }
          }
        }); 
        //监听提交
        form.on('submit(formSubmit)', function(data){
            layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
            $.ajax({
                type : 'post',
                url : "{:url('/system.web/basic')}",
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll('loading');
                    if(res.status){
                        layer.msg(res.msg, {icon:1, time:1000}, function(){
                            window.location.reload();
                        });
                    }else{
                        layer.msg(res.msg, {icon:2, time:1000});
                    }
                },
                error: function(e){
                    layer.closeAll('loading');
                    layer.msg('未知错误，操作中断！', {icon:2, time:1000});
                }
            });
            return false;
        });
  });
</script>
</body>
</html>